#include "cubes.h"
#include "ui_cubes.h"
#include "QPainter"
#include "QTimer"
#include "QKeyEvent"


void Cubes::Next()
{
    CubeRect.resize(4);
    CubeRect1.resize(4);
    for(int i=0;i<CubeRect1.size();i++)
    {
        QRect rect(800+25*i,375,25,25);
        CubeRect1[CubeRect1.size()-1-i]=rect;
    }//----
    CubeRect2.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect2[CubeRect2.size()-1-i]=rect;
        }
        else
        {
            QRect rect(800+25*(i-1),400,25,25);
            CubeRect2[CubeRect2.size()-1-i]=rect;
        }
    }//-=-
    CubeRect3.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i<2)
        {
            QRect rect(825+25*i,375,25,25);
            CubeRect3[CubeRect3.size()-1-i]=rect;
        }
        else
        {
            QRect rect(825+25*(i-2),400,25,25);
            CubeRect3[CubeRect3.size()-1-i]=rect;
        }
    }//==
    CubeRect4.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect4[CubeRect4.size()-1-i]=rect;
        }
        if(i==1||i==2)
        {
            QRect rect(825+25*(i-1),400,25,25);
            CubeRect4[CubeRect4.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(850,425,25,25);
            CubeRect4[CubeRect4.size()-1-i]=rect;
        }
    }//=-_
    CubeRect5.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(850,375,25,25);
            CubeRect5[CubeRect5.size()-1-i]=rect;
        }
        if(i==1)
        {
            QRect rect(850,400,25,25);
            CubeRect5[CubeRect5.size()-1-i]=rect;
        }
        if(i==3||i==2)
        {
            QRect rect(850+(i-2)*25,425,25,25);
            CubeRect5[CubeRect5.size()-1-i]=rect;
        }
    }//=__
    CubeRect6.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect6[CubeRect6.size()-1-i]=rect;
        }
        if(i==1)
        {
            QRect rect(825,400,25,25);
            CubeRect6[CubeRect6.size()-1-i]=rect;
        }
        if(i==3||i==2)
        {
            QRect rect(800+(i-2)*25,425,25,25);
            CubeRect6[CubeRect6.size()-1-i]=rect;
        }
    }//__=
    CubeRect7.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect7[CubeRect7.size()-1-i]=rect;
        }
        if(i==1||i==2)
        {
            QRect rect(800+(25*(i-1)),400,25,25);
            CubeRect7[CubeRect7.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(800,425,25,25);
            CubeRect7[CubeRect7.size()-1-i]=rect;
        }
    }
    CubeRect8.resize(4);
    for(int i=0;i<4;i++)
    {
        QRect rect(825,375+25*i,25,25);
        CubeRect8[CubeRect8.size()-1-i]=rect;
    }
    CubeRect9.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect9[CubeRect9.size()-1-i]=rect;
        }
        if(i==1||i==2)
        {
            QRect rect(825+25*(i-1),400,25,25);
            CubeRect9[CubeRect9.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(825,425,25,25);
            CubeRect9[CubeRect9.size()-1-i]=rect;
        }
    }
    CubeRect10.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1||i==2)
        {
            QRect rect(800+25*i,375,25,25);
            CubeRect10[CubeRect10.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(825,400,25,25);
            CubeRect10[CubeRect10.size()-1-i]=rect;
        }
    }
    CubeRect11.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(825,375,25,25);
            CubeRect11[CubeRect11.size()-1-i]=rect;
        }
        if(i==1||i==2)
        {
            QRect rect(800+25*(i-1),400,25,25);
            CubeRect11[CubeRect11.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(825,425,25,25);
            CubeRect11[CubeRect11.size()-1-i]=rect;
        }
    }
    CubeRect12.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1)
        {
            QRect rect(825+25*i,375,25,25);
            CubeRect12[CubeRect12.size()-1-i]=rect;
        }
        if(i==3||i==2)
        {
            QRect rect(800+25*(i-2),400,25,25);
            CubeRect12[CubeRect12.size()-1-i]=rect;
        }
    }
    CubeRect13.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1||i==2)
        {
            QRect rect(800+25*i,375,25,25);
            CubeRect13[CubeRect13.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(800,400,25,25);
            CubeRect13[CubeRect13.size()-1-i]=rect;
        }
    }
    CubeRect14.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1)
        {
            QRect rect(800+25*i,375,25,25);
            CubeRect14[CubeRect14.size()-1-i]=rect;
        }
        if(i==2)
        {
            QRect rect(825,400,25,25);
            CubeRect14[CubeRect14.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(825,425,25,25);
            CubeRect14[CubeRect14.size()-1-i]=rect;
        }
    }
    CubeRect15.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(850,375,25,25);
            CubeRect15[CubeRect15.size()-1-i]=rect;
        }
        if(i==3||i==1||i==2)
        {
            QRect rect(800+25*(i-1),400,25,25);
            CubeRect15[CubeRect15.size()-1-i]=rect;
        }
    }
    CubeRect16.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0)
        {
            QRect rect(800,375,25,25);
            CubeRect16[CubeRect16.size()-1-i]=rect;
        }
        if(i==3||i==1||i==2)
        {
            QRect rect(800+25*(i-1),400,25,25);
            CubeRect16[CubeRect16.size()-1-i]=rect;
        }
    }
    CubeRect17.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1)
        {
            QRect rect(825+25*i,375,25,25);
            CubeRect17[CubeRect17.size()-1-i]=rect;
        }
        if(i==2)
        {
            QRect rect(825,400,25,25);
            CubeRect17[CubeRect17.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(825,425,25,25);
            CubeRect17[CubeRect17.size()-1-i]=rect;
        }
    }
    CubeRect18.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1||i==2)
        {
            QRect rect(800+25*i,375,25,25);
            CubeRect18[CubeRect18.size()-1-i]=rect;
        }
        if(i==3)
        {
            QRect rect(850,400,25,25);
            CubeRect18[CubeRect18.size()-1-i]=rect;
        }
    }
    CubeRect19.resize(4);
    for(int i=0;i<4;i++)
    {
        if(i==0||i==1)
        {
            QRect rect(800+25*i,375,25,25);
            CubeRect19[CubeRect19.size()-1-i]=rect;
        }
        if(i==3||i==2)
        {
            QRect rect(825+25*(i-2),400,25,25);
            CubeRect19[CubeRect19.size()-1-i]=rect;
        }
    }
    switch(next)
    {
        case 0:
        {
            CubeRect = CubeRect1;
            break;
        }
        case 1:
        {
            CubeRect = CubeRect2;
            break;
        }
        case 2:
        {
            CubeRect = CubeRect3;
            break;
        }
        case 3:
        {
            CubeRect = CubeRect4;
            break;
        }
        case 4:
        {
            CubeRect = CubeRect5;
            break;
        }
        case 5:
        {
            CubeRect = CubeRect6;
            break;
        }
        case 6:
        {
            CubeRect = CubeRect7;
            break;
        }
        case 7:
        {
            CubeRect = CubeRect8;
            break;
        }
        case 8:
        {
            CubeRect = CubeRect9;
            break;
        }
        case 9:
        {
            CubeRect = CubeRect10;
            break;
        }
        case 10:
        {
            CubeRect = CubeRect11;
            break;
        }
        case 11:
        {
            CubeRect = CubeRect12;
            break;
        }
        case 12:
        {
            CubeRect = CubeRect13;
            break;
        }
        case 13:
        {
            CubeRect = CubeRect14;
            break;
        }
        case 14:
        {
            CubeRect = CubeRect15;
            break;
        }
        case 15:
        {
            CubeRect = CubeRect16;
            break;
        }
        case 16:
        {
            CubeRect = CubeRect17;
            break;
        }
        case 17:
        {
            CubeRect = CubeRect18;
            break;
        }
        case 18:
        {
            CubeRect = CubeRect19;
            break;
        }
    }
}
